package com.arr;

public class TestArrayCopy {

	public static void main(String args[]){
		String[] s1 = {"Mircrosoft","IBM","Sun"};
		String[] s2 = new String[3];
		System.arraycopy(s1, 0, s2, 0, 3);
		
		s2[1] = "lalal";
		
		for(int i = 0;i < s1.length;i++)
		{
			System.out.println(s1[i]);
		}
		
		for(int i = 0;i < s2.length;i++)
		{
			System.out.println(s2[i]);
		}
		
		
		int[][] a1 = {{1,2},{2,3,4},{4,2,1}};
		int[][] a2 = new int[3][];
		System.arraycopy(a1, 0, a2, 0, 3);
		
		a2[2][2] = 100;
		for(int i = 0;i < a1.length; i++)
		{
			for(int j = 0;j < a1[i].length;j++)
			{
				System.out.println(a1[i][j]);
			}
		}
		
	}
}
